import { Alova } from '@/utils/http/alova/index';

// 账单记录接口参数类型
export interface BillingParams {
  unique_str: string;
  page: number;
  pageSize: number;
}

// 账单记录数据项类型
export interface BillingRecord {
  id: number;
  admin_agent_id: number;
  type: string;
  refund_type: string;
  agent_id: number;
  platform_id: number;
  group_id: string;
  member_id: number;
  account_id: string;
  day: number;
  wxid: string;
  amount: string;
  actual_amount: string;
  status: string;
  payinfo: string | null;
  ctime: number;
  rebate: string;
  rebate_amount: string;
  channel_rebate: string;
  channel_rebate_type: number;
  channel_receive: string;
  channel_tome: string;
  public_rebate: string;
  public_amount: string;
  profit: string;
  remark: string;
  upstream_api: string;
  third_order_no: string | null;
  created_at: string;
  updated_at: string;
  test_user: number;
  upstream_log_id: number;
  substream_log_id: number;
  a1_agent_id: number;
  a2_agent_id: number;
  a2_account_id: number;
  amount_a2: string | null;
  actual_amount_a2: string;
  rebate_a2: string;
  rebate_amount_a2: string;
  channel_rebate_a2: string;
  channel_rebate_type_a2: number;
  channel_receive_a2: string;
  channel_tome_a2: string;
  public_rebate_a2: string;
  public_amount_a2: string;
  profit_a2: string;
  wallet_account_id: string | null;
}

// API响应数据类型
export interface BillingResponse {
  current_page: number;
  data: BillingRecord[];
  first_page_url: string;
  from: number;
  next_page_url: string | null;
  path: string;
  per_page: number;
  prev_page_url: string | null;
  to: number;
}

// 获取账单记录
export function getBillingRecords(params: BillingParams) {
  return Alova.Post('/api/ucenter/recharge/logs', params, {
    meta: {
      isTransformResponse: false,
    },
  });
}

// 获取转账记录
export function getTransferRecords(params: BillingParams) {
  return Alova.Post('/api/ucenter/transfer/logs', params, {
    meta: {
      isTransformResponse: false,
    },
  });
}

// 获取账变记录
export function getChangeRecords(params: BillingParams) {
  return Alova.Post('/api/ucenter/finance/logs', params, {
    meta: {
      isTransformResponse: false,
    },
  });
}

// 获取回款记录
export function getBankRecords(params: BillingParams) {
  return Alova.Post('/api/ucenter/bank/logs', params, {
    meta: {
      isTransformResponse: false,
    },
  });
}